﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace VTNT.Presentation.Web.MIS.mods.demo.entry.service
{
    /// <summary>
    /// Summary description for data
    /// </summary>
    public class data : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var ret = "";
            string action = context.Request.Form["action"];

            switch (action)
            {
                case "getInfo":
                    ret = getInfo();
                    break;
                default:
                    ret = getInfo();
                    break;

            }
            context.Response.Write(ret);
            context.Response.End();
        }

        public string getInfo()
        {
            string ret = "" +
                "Code;Name;Message\n" +
                "'OK';'Action Result';'Action successful'\n" +

                "###\n" +
                "ID;Code;Name;DefaultValue\n" +
                "1;\"VN\";\"Vietnam\";true\n" +
                "2;\"US\";\"United States\";false\n" +
                "3;\"EN\";\"United Kingdom\";true\n" +

                "###\n" +
                "ID;Code;Name\n" +
                "1;\"Travel\";\"Travel\"\n" +
                "2;\"Movie\";\"Movie\"\n" +
                "3;\"Sport\";\"Sport\"\n";

            return ret;
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}